<template>
  <div class="container">
    <!-- <div class="title">
      <van-icon name="arrow-left" class="title-icon"/>
      <p>更多直播</p>
    </div> -->
    <Header  :headerObj = 'headerObj '/>
    <div class="content-list">
<!--    	<van-list
    	  v-model="loading"
    	  :finished="finished"
    	  :finished-text="没有更多了"
    	  @load="loadMore"
    	  :immediate-check="false"
    	  :offset="20"
    	> -->
    		<div class="content-list-item" v-for="(item,index) in liveBroadcastList" :key="index" @click="itemClick(item,index)">
          <p class="item-p1">{{item.title}}</p>
          <p class="item-p2">{{item.beginTime}}</p>
          <div class="item-img">
            <img :src="item.imagUrl" alt="">
            <div class="item-title-img-type" v-if="item.roomStatus == 0">
              <div class="title-img-left">
                <img src="@/assets/images/zxjt/yugao.png" alt="" class="yugao">
                <span>预告</span>
              </div>
              <div class="title-img-right">
                <img src="@/assets/images/zxjt/bannerBg.png" alt="">
                <span>12月31日 13:00</span>
              </div>
            </div>
            <div class="item-title-img" v-else>
              <div class="title-img-left">
                <img src="@/assets/images/zxjt/zhibozhong.png" alt="" class="zhibo">
                <span>直播中</span>
              </div>
              <div class="title-img-right">
                <img src="@/assets/images/zxjt/bannerBg.png" alt="">
                <span>18394人观看</span>
              </div>
            </div>
          </div>
    		</div>
    	<!-- </van-list> -->
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        loading:false,
        finished:false,
        liveBroadcastList:[],
        p:1, //页数
        headerObj:{
        	'isShowBack':true,
        	'isShowClose':true,
        	'isShowMine':true,
        	'fromType':'mine',
        	'titleText':'更多直播',
        	'color':'white'
        },
      }
    },
    created(){
      this.getVideoRecommendationList()
    },
    methods: {
  	loadMore(){
  		this.p++;
  		let data = {
  		  "p" : this.p,
  		};
  		this.$http.get(`/h5live/getRoomList?plat=${fun.getPlatform()}`).then(res=>{
        if(res.data.code == "000000"){
          let data = res.data.data;
          if (data.length === 0) {
          	// 加载结束
          	this.finished = true;
          	return;
          }
          this.loading = false;
          this.liveBroadcastList = this.liveBroadcastList.concat(data)
        }
  		}).catch(function(error) {
          console.log(error);
      });
  	},
      getVideoRecommendationList(){
        this.$http.get(`/h5live/getRoomList?plat=${fun.getPlatform()}`).then(res=>{
          if(res.data.code == "000000"){
            let data = res.data.data.forecastRoomList;
            this.liveBroadcastList = data;
            console.log(this.liveBroadcastList,111)
          }
        }).catch(function(error) {
          console.log(error);
        });
      },
      itemClick(item){
        // 每一项的跳转
        this.$router.push(`/${this.$channel}/liveRoom/${item.roomId}?dzhPage=true`);
      },
    }
  }
</script>

<style scoped="scoped">
  .container{
    width: 100%;
    height: 100%;
    /* margin-top: 88px; */
  }

  .title{
    padding: 22px 0;
    border-bottom: 1px solid #EEEEEE ;
  }
  .title p{
    text-align: center;
  }
  .title-icon{
    float: left;
    margin-left: 32px;
  }

  .content-list{
    padding: 0 31px 0 29px;
  }
  .content-list .content-list-item:nth-child(1){
    margin-top: 32px;
  }
  .content-list .content-list-item:not(:nth-child(1)){
    margin-top: 60px;
  }
  .content-list-item .item-p1{
    font-size: 32px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #333333;
    line-height: 45px;
    letter-spacing: 1px;
  }
  .content-list-item .item-p2{
    margin-top: 8px;
    font-size: 30px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #666666;
    line-height: 42px;
    letter-spacing: 1px;
  }
  .item-img{
    margin-top: 12px;
    position: relative;
  }
  .item-img>img{
    width: 690px;
    height: 390px;
    border-radius: 10px;
  }
  .item-title-img,.item-title-img-type{
    height: 58px;
  }
  .item-img .item-title-img,.item-title-img-type{
    position: absolute;
    top: 0;
    left: 0;
  }
  .title-img-left,.title-img-right{
    position: relative;
  }
  .title-img-left{
    z-index: 99999;
  }
  .title-img-left .zhibo{
    width: 117px;
    height: 100%;
  }
  .title-img-left .yugao{
    width: 98px;
    height: 100%;
  }
  .title-img-left,.title-img-right span{
    font-size: 28px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #FFFFFF;
    line-height: 40px;
  }
  .title-img-left span{
    position: absolute;
    left: 12px;
    top: 9px;
  }
  .title-img-right{
    float: left;
    margin-top: -67px;
    margin-left: 56px;
  }
  .title-img-right img{
    width: 241px;
    height: 58px;
    border-radius: 10px;
  }
  .title-img-right span{
    position: absolute;
    left: 56px;
    top: 9px;
  }
  .item-title-img-type .title-img-right{
    margin-left: 68px;
  }
  .item-title-img-type .title-img-right span{
    left: 25px;
  }
</style>
